#include "Sock.hpp"
#include <unistd.h>
int main()
{
    Sock sock;
    int listensock = sock.Socket();
    sock.Bind(listensock, 8080);
    sock.Listen(listensock);

    while (true)
    {
        std::string ip;
        uint16_t port;
        int sockfd = sock.Accept(listensock, &ip, &port);

        if (sockfd > 0)
        {
            std::cout << "[" << ip << ":" << port << "]# " << sockfd << std::endl;
        }
        sleep(10);

        close(sockfd);

        std::cout << sockfd << " closed" << std::endl;
    }

    return 0;
}